#include<bits/stdc++.h>
#define int long long 
using namespace std;

const int N=1e5+10;
int n,cnt,s;
int h[N];
int num[N];

signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>num[i];
        h[num[i]]++;
    }
    sort(num+1,num+1+n);
    for(int i=1;i<=n;i++){
        int j=i;
        while(num[j]==num[i]&&j<=n) j++;
        j--;
        int k=j-i+1;
        k=min(k,s);
        cnt+=k;
        s=s+h[num[i]]-k;
        i=j;
    }
    cout<<n-cnt<<endl;
    return 0;
}